﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GalaSoft.MvvmLight;

namespace EMC2.ViewModel
{
    class MainViewModel : ObservableObject
    {

        private bool _isConnected = false;
        //public bool IsConnected { get => _isConnected; set => Set(ref _isConnected, value); }
        public bool IsConnected
        {
            get => _isConnected;
            set
            {
                _isConnected = value;
                OnPropertyChanged(nameof(IsConnected));
                OnPropertyChanged(nameof(SvgConnection));
                OnPropertyChanged(nameof(ConnectionText));
            }
        }
        public string SvgConnection => IsConnected ? "/Icon/Connected.svg" : "/Icon/Disconnected.svg";
        public string ConnectionText => IsConnected ? $"连接{Environment.NewLine}（已连接）" : $"连接{Environment.NewLine}（未连接）";

        protected void OnPropertyChanged(string propertyName) =>
        PropertyChangedHandler?.Invoke(this, new PropertyChangedEventArgs(propertyName));

 
      private bool _isEnabled = false;
        //public bool IsEanbled { get => _isEnabled; set => Set(ref _isEnabled, value); }
        public bool IsEnabled
        {
            get => _isEnabled;
            set
            {
                _isEnabled = value;
                OnPropertyChanged(nameof(IsEnabled));
                OnPropertyChanged(nameof(SvgEnable));
                OnPropertyChanged(nameof(EnableText));
            }
        }
        public string SvgEnable => IsEnabled ? "/Icon/Enabled.svg" : "/Icon/Disabled.svg";
        public string EnableText => IsEnabled ? $"已使能{Environment.NewLine}" : $"未使能{Environment.NewLine}";


    } 
}
